<%+cbi/valueheader%>
<script type="text/javascript">
    //<![CDATA[
    function refresh_data(btn, dataname) {
        btn.disabled = true;
        btn.value = "<%:Refresh...%> ";
        murl = dataname;
        XHR.get(
            '<%=luci.dispatcher.build_url("admin", "services", "adbyby","refresh")%>',
            {
                set: murl,
            },
            function (x, rv) {
                var s = document.getElementById(dataname + "-status");
                if (s) {
                    if (rv.ret == "0")
                        s.innerHTML =
                            "<font color='green'>" +
                            "<%:No new data!%> " +
                            "</font>";
                    else if (rv.ret == "-1") {
                        s.innerHTML =
                            "<font color='red'>" +
                            "<%:Refresh Error!%> " +
                            "</font>";
                    } else {
                        s.innerHTML =
                            "<font color='green'>" +
                            "<%:Refresh OK!%> " +
                            "<%:Total Records:%>" +
                            rv.ret +
                            "</font>";
                    }
                }
                btn.disabled = false;
                btn.value = "<%:Refresh Data %>";
            }
        );
        return false;
    }
    //]]>
</script>
<input
    type="button"
    class="cbi-button cbi-input-reload"
    value="<%:Refresh Data%> "
    onclick="return refresh_data(this,'<%=self.option%>')"
/>
<span id="<%=self.option%>-status"><em><%=self.value%></em></span>
<%+cbi/valuefooter%>
